import React, {Component} from 'react';
import {observer,inject} from 'mobx-react'
import './Screen.css'
import {Button} from 'element-react'

@inject('todoStore')
@observer
class Mobx extends Component {
     setName=()=>{
         const {todoStore} = this.props
         todoStore.setName()
     }
    render() {
        const {todoStore} = this.props
        return (
            <div className="container">
                <h1>{todoStore.id}</h1>
               <h1>{todoStore.name}</h1>
                <Button onClick={this.setName}>改变姓名</Button>
               <h1>'computed:'{todoStore.unfinshedName ? "true":"false"}</h1>
            </div>
        );
    }
}

export default Mobx;